{include file="common/head"}
<head>
<title>咨讯管理</title>

<style>
  .box{border: 0px solid #ccc;text-align: left;padding:10px 20px;}
</style>
</head>
<body style="">


<div class="box "  style="border:0 solid #ccc;"  >

    <h2>资讯管理</h2>
    <table class="table table-sm table-hover table-striped" >

        <thead>
            <th>编号</th>
            <th>image</th>               
            <th>标题</th>
            <th>内容</th>
            <th>时间</th>
            <th>状态</th>
            <th>
              <button type="button" class="btn btn-sm btn-primary" id="news_add">
                  <span class="bi-plus-lg" style="color:white;"></span>
              </button>
            </th>
        </thead>

        <tbody>
            {foreach $list['data'] as $k=>$kv}
            <tr>
                <td>{$kv['id']}</td>
                <td><img src="{$kv['image']}"  style="width:100px;" /></td>                
                <td style="
                    {if $kv['status']>1} color:red; {/if} 
                    {if $kv['status']>2} text-decoration:line-through; {/if}
                ">{$kv['title']}</td>
                <td style="max-width:300px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">{$kv['content2']}</td>
                <td>{$kv['create_time']}</td>
                <td>{$kv['status']}</td>
                <td>
                    <button style="button" class="btn btn-sm btn-info news_edit" news_id="{$kv['id']}" ><span class="bi-pencil"></span></button>
                </td>
            </tr>
            {/foreach}

        </tbody>    
    </table>

    {include file="common/pagination"}
  </div>

<script type="text/javascript">

    $(function(){
      $("#news_add").on('click',function(){
        location.href="/index/news_edit";
      })      


      $(".news_edit").on('click',function(){
        var id = $(this).attr('news_id');
        var url ="/index/news_edit/id/"+id;
        console.log(url);
        location.href=url;
      })
    })

</script>


</body>
</html>
